package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author 东哥
 * @since 2024-11-12
 */
@Api(tags = "互动回答-回答-评论相关接口")
@RestController
@RequestMapping("/replies")
@RequiredArgsConstructor
public class InteractionReplyController {
    private final IInteractionReplyService replyService;

    /**
     * 1.分页查询【回答】或【评论】列表
     */
    @ApiOperation("分页查询回答、评论列表")
    @GetMapping("/page")
    public PageDTO<ReplyVO> pageReply(ReplyPageQuery query){
        return replyService.pageReply(query);
    }


    /**
     * 2. 新增【回答】或者【评论】 (用户端和管理端公用)
     */
    @ApiOperation("新增回答、评论")
    @PostMapping
    public void saveReply(@RequestBody ReplyDTO replyDTO){
        replyService.saveReply(replyDTO);
    }

}
